﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCClubSite.Web;
using MVCClubSite.Web.Controllers;
using MVCClubSite.BLL;
using MVCClubSite.Model;

namespace MVCClubSite.Tests.Controllers
{
    /// <summary>
    /// Summary description for HomeControllerTest
    /// </summary>
    [TestClass]
    public class HomeControllerTest : TestBase
    {
        [TestMethod]
        public void Index()
        {
            // Arrange
            HomeController controller = new HomeController(_announcementsService);

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual(5, (viewData["RecentAnnouncements"] as IList<Announcement>).Count);
        }

        [TestMethod]
        public void About()
        {
            AnnouncementsService _announcementService;
            _announcementService = new AnnouncementsService(new MVCClubSite.TestDAL.TestAnnouncementsData());

            // Arrange
            HomeController controller = new HomeController(_announcementService);

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("About Page", viewData["Title"]);
        }
    }
}
